package com.faithbj.process.impl;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Date;

/**
 * User: xiongyuanwei
 * Date: 12-7-17
 * Time: 下午2:11
 */
public class ProcessInstanceIdNodeNameStartAndEndDateTuple implements Externalizable {

    private long processInstanceId;
    private String nodeName;
    private Date startDate;
    private Date endDate;

    public ProcessInstanceIdNodeNameStartAndEndDateTuple() {

    }

    public ProcessInstanceIdNodeNameStartAndEndDateTuple(long processInstanceId, String nodeName, Date startDate, Date endDate) {
        this.processInstanceId = processInstanceId;
        this.nodeName = nodeName;
        this.startDate = startDate;
        this.endDate = endDate;
    }

    @Override
    public void writeExternal(ObjectOutput out) throws IOException {
        out.writeLong(processInstanceId);
        out.writeUTF(nodeName);
        out.writeLong(startDate.getTime());
        out.writeLong(endDate.getTime());
    }

    @Override
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        processInstanceId = in.readLong();
        nodeName = in.readUTF();
        startDate = new Date(in.readLong());
        endDate = new Date(in.readLong());
    }

    public long getProcessInstanceId() {
        return processInstanceId;
    }

    public void setProcessInstanceId(long processInstanceId) {
        this.processInstanceId = processInstanceId;
    }

    public String getNodeName() {
        return nodeName;
    }

    public void setNodeName(String nodeName) {
        this.nodeName = nodeName;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }
}
